#pragma once

#include "../DefinesCore.hpp"
#include <string>
#include <vector>

CYBERTRON_BEGIN

class UtilFile
{
public:
	CybertronCoreAPI static bool exist(const std::string& path);

	CybertronCoreAPI static bool executableExist(const std::string path);

	CybertronCoreAPI static std::string readUTF8StringFromFile(const std::string& inputPath);
	CybertronCoreAPI static void writeUtf8StringToFile(
		const std::string& path,
		const std::string& content);

	CybertronCoreAPI static bool tryLoad(
		const std::string& path,
		std::vector<std::uint8_t>& buffer);
	CybertronCoreAPI static std::vector<std::uint8_t> load(const std::string& path);

	CybertronCoreAPI static bool trySave(
		const std::string& path,
		const std::uint8_t* pData,
		size_t size);
	CybertronCoreAPI static bool trySave(
		const std::string& path,
		const std::vector<std::uint8_t>& buffer);
	CybertronCoreAPI static void save(
		const std::string& path,
		const std::vector<std::uint8_t>& buffer);

	CybertronCoreAPI static bool tryOpen(
		std::fstream& stream,
		const std::string& path,
		int mode);
};

CYBERTRON_END
